<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=C60df98e33c245dd666a3264ae592e06"></script>
    
    <style type="text/css">
	body, html{width: 100%;height: 100%;overflow: hidden;margin:0;}
	#l-map {height: 100%;overflow: hidden;}	
    </style>

    <title><!--{$title}--></title>
</head>
<body>
    <div id="l-map"></div>
    <script type="text/javascript">
    var dataDriver = <!--{$shop_info}-->;
    var map = new BMap.Map("l-map");          // 创建地图实例
	var lng = dataDriver[0]['longitude'];
	var lat = dataDriver[0]['latitude'];
    var bpoint = new BMap.Point(lng,lat);  // 创建点坐标
        if(<!--{$type}--> > 0){
            //独占
            map.centerAndZoom(bpoint, 15);                 // 初始化地图，设置中心点坐标和地图级别
        }else{
            //共享
            map.centerAndZoom(bpoint, 13);                 // 初始化地图，设置中心点坐标和地图级别
        }
    map.enableScrollWheelZoom();
    map.addControl(new BMap.NavigationControl());  //添加默认缩放平移控件

	// 创建标注对象并添加到地图
    var marker = new BMap.Marker(bpoint);
    
    var licontent= "<p>"+dataDriver[0]['name'];
    if(dataDriver[0]['baidu_location']){
    	licontent += ' <a href="'+dataDriver[0]['baidu_location']+'">导航</a>';
    }
    licontent += "</p><p>"+dataDriver[0]['address']+"</p>";
    var opts1 = { width: 200 };
    var  infoWindow = new BMap.InfoWindow(licontent, opts1);
    map.addEventListener('tilesloaded',function (){
    	marker.openInfoWindow(infoWindow);
    });
    
        map.addOverlay(marker);

    if(<!--{$s_count}--> >= 1){
        for(var i=0;i<<!--{$s_count}-->;i++){
            if(i > 0){
                var bpoints = new BMap.Point(dataDriver[i]['longitude'],dataDriver[i]['latitude']);  // 创建点坐标

                // 创建标注对象并添加到地图
                var marker2 = new BMap.Marker(bpoints);
                map.addOverlay(marker2);

                marker2.addEventListener('click', function(){
                    var licontent= "<p>"+dataDriver[i]['name'];
                    if(dataDriver[i]['baidu_location']){
                    	licontent += ' <a href="'+dataDriver[i]['baidu_location']+'">导航</a>';
                    }
                    licontent += "</p><p>"+dataDriver[i]['address']+"</p>";
                    var opts1 = { width: 200 };
                    var  infoWindow = new BMap.InfoWindow(licontent, opts1);
                    var openInfoWinFun = function(){
                        marker2.openInfoWindow(infoWindow);
                    }
                    marker2.addEventListener("click", openInfoWinFun);
                });
            }
        }
    }
    
    

    </script>

</body>
</html>